package demo06233;


import java.util.Scanner;

public class EmployeeTest {
    public static void main(String[] args) {
      Scanner scanner = new Scanner(System.in);

      System.out.println("=== 职工信息录入系统 ===");


      System.out.println("\n方式1：使用无参构造创建对象");
      Employee emp1 = new Employee();

      System.out.print("请输入职工编号: ");
      emp1.setEmployeeId(scanner.nextLine());

      System.out.print("请输入姓名: ");
      emp1.setName(scanner.nextLine());

      System.out.print("请输入部门: ");
      emp1.setDepartment(scanner.nextLine());

      System.out.print("请输入年龄: ");
      emp1.setAge(scanner.nextInt());
      scanner.nextLine(); // 清除缓冲区

      System.out.print("请输入性别: ");
      emp1.setGender(scanner.nextLine());

      System.out.print("请输入联系方式: ");
      emp1.setPhone(scanner.nextLine());

      emp1.displayInfo();


      System.out.println("\n方式2：使用有参构造创建对象");
      System.out.print("请输入职工编号: ");
      String id = scanner.nextLine();

      System.out.print("请输入姓名: ");
      String name = scanner.nextLine();

      System.out.print("请输入部门: ");
      String dept = scanner.nextLine();

      System.out.print("请输入年龄: ");
      int age = scanner.nextInt();
      scanner.nextLine();

      System.out.print("请输入性别: ");
      String gender = scanner.nextLine();

      System.out.print("请输入联系方式: ");
      String phone = scanner.nextLine();

      Employee emp2 = new Employee(id, name, dept, age, gender, phone);
      emp2.displayInfo();

      scanner.close();
    }
  }